import { formatTime } from '@/utils'

export const routeRule = {
  // name: [
  //   { required: true, message: '请输入版本名称', trigger: 'change' }
  // ],
  section: [
    { required: true, message: '请选择工段', trigger: 'change' }
  ]
}

export const routeHeader = ['顺序/站号', '生效/主站', '合并/比例', '工序信息/站号信息' ,'员工信息', '操作']
export const viewRouteHeader = ['顺序/站号', '生效/主站', '合并/比例', '工序信息/站号信息','员工信息' ]
export const routeHeaderWeb = ['顺序/站号', '生效/主站', '合并/比例', '工序信息/站号信息','员工信息', '操作']
export const viewRouteHeaderWeb = ['顺序/站号', '生效/主站', '合并/比例', '工序信息/站号信息','员工信息']
export const processHeader = ['序号', '工段', '工序号', '工序名称']
export const siteHeader = ['序号', '流水线号', '站号', '角色']
export const stationTypeList = [{ name: '普通', value: '0' }, { name: '存储', value: '1' } , { name: '返工', value: '2' }]

export const stationRule = {
  role: [{
    required: true,
    trigger: 'change',
  }],
  receiveHangerBoolean: [{
    required: true,
    trigger: 'change',
  }],
  proportion: [{
    required: true,
    trigger: 'change',
  }],
  type: [{
    required: true,
    trigger: 'change',
  }]
}

export const listOutColumns =  [
  {
    title: '序号', dataIndex: 'index', key: 'index', align: 'center', width: 80,
    customRender: ({ index }) => {
      return index + 1
    }
  },
  { title: '制单号', dataIndex: 'moNo', key: 'moNo', align: 'center', width: 130 },
  { title: '款号', dataIndex: 'styleNo', key: 'styleNo', align: 'center', width: 130 },
  { title: '款名', dataIndex: 'styleName', key: 'contactPerson', align: 'center', width: 130 },
  { title: '版本数', dataIndex: 'versionNo', key: 'versionNo', align: 'center', width: 100 },
  {
    title: '创建时间', dataIndex: 'createTime', key: 'createTime', align: 'center', width: 170,
    customRender: ({ text }) => {
      return formatTime(text, 'YYYY-MM-DD HH:mm:ss')
    }
  },
  {
    title: '最后编辑时间', dataIndex: 'updateTime', key: 'updateTime', align: 'center', width: 170,
    customRender: ({ text }) => {
      return formatTime(text, 'YYYY-MM-DD HH:mm:ss')
    }
  },
  { title: '状态', dataIndex: 'status', key: 'status', align: 'center', width: 130 }, 
  { title: '操作', dataIndex: 'operate', key: 'operate', align: 'center', width: 130, fixed: 'right' },
]
export const listInnerColumns =  [
  {
    title: '序号', dataIndex: 'index', key: 'index', align: 'center', width: 80,
    customRender: ({ index }) => {
      return index + 1
    }
  },
  { title: '路线图版本名称', dataIndex: 'name', key: 'name', align: 'center', width: 150 },
  { title: '工序版本名称', dataIndex: 'processName', key: 'processName', align: 'center', width: 160 },
  { title: '开始工序', dataIndex: 'startProcess', key: 'startProcess', align: 'center', width: 130,
    customRender: ({ text }) => {
      return text && text.name
    } 
  },
  { title: '结束工序', dataIndex: 'endProcess', key: 'endProcess', align: 'center', width: 130, 
    customRender: ({ text }) => {
      return text && text.name
    } 
  },
  {
    title: '创建时间', dataIndex: 'createTime', key: 'createTime', align: 'center', width: 170,
    customRender: ({ text }) => {
      return formatTime(text, 'YYYY-MM-DD HH:mm:ss')
    }
  },
  {
    title: '最后编辑时间', dataIndex: 'updateTime', key: 'updateTime', align: 'center', width: 170,
    customRender: ({ text }) => {
      return formatTime(text, 'YYYY-MM-DD HH:mm:ss')
    }
  },
  { title: '状态', dataIndex: 'status', key: 'status', align: 'center', width: 90 },
  { title: '操作', dataIndex: 'operate', key: 'operate', align: 'center', width: 200, fixed: 'right' },
]
export const copyColumns =  [
  {
    title: '序号', dataIndex: 'index', key: 'index', align: 'center', width: 60,
    customRender: ({ index }) => {
      return index + 1
    }
  },
  { title: '制单号', dataIndex: 'moNo', key: 'moNo', align: 'center'},
  { title: '款号', dataIndex: 'styleNo', key: 'styleNo', align: 'center'},
  { title: '款名', dataIndex: 'style', key: 'style', align: 'center' },
  { title: '产品类型', dataIndex: 'productType', key: 'productType', align: 'center' },
]

export const queryStatusOptions = [
  { value: 0, key: '未投产' },
  { value: 1, key: '生产中' },
  { value: 2, key: '已完成' },
]